package com.gistone.commis.mapper;

import com.gistone.commis.entity.Attendance;
import com.gistone.commis.query.QueryAttendance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;

@Mapper
public interface AttendanceMapper {


    @Select("SELECT * FROM tb_person_att")
    List<Attendance> findAttendances();

    List<Attendance> selectSelective(QueryAttendance attendance);

    int deleteByPrimaryKey(Integer attId);

    int insert(Attendance record);

    int insertSelective(Attendance record);

    Attendance selectByPrimaryKey(Integer attId);


    @Select("SELECT * FROM tb_person_att WHERE att_year = #{0} and att_month = #{1}")
    List<Attendance> selectByYearAndMonth(Integer year, Integer month);

    @Select("SELECT * FROM tb_person_att WHERE person_id= #{0} and att_year = #{1} and att_month = #{2}")
    Attendance  selectByPersonAndYearAndMonth(Integer id,Integer year, Integer month);

    @Select("SELECT * FROM tb_person_att WHERE community_id=#{0} and att_year = #{1} and att_month = #{2}")
    List<Attendance> selectByCommunityAndYearAndMonth(Integer id ,Integer year, Integer month);

    int updateByPrimaryKeySelective(Attendance record);

    int updateByPrimaryKey(Attendance record);
}